A Linearly Typed Assembly Language
نویسندگان
چکیده
Today’s type-safe low-level languages rely on garbage collection to recycle heap-allocated objects safely. We present LTAL, a safe, low-level, yet simple language that “stands on its own”: it guarantees safe execution within a fixed memory space, without relying on external run-time support. We demonstrate the expressiveness of LTAL by giving a type-preserving compiler for the functional core of ML. But this independence comes at a steep price: LTAL’s type system imposes a draconian discipline of linearity that ensures that memory can be reused safely, but prohibits any useful kind of sharing. We present the results of experiments with a prototype LTAL system that show just how high the price of linearity can be. 1 Background and Motivation Safety certification systems such as Java or MSIL bytecode verification make it possible to verify the safety of code obtained from an untrusted provider or over an untrusted network [13, 7]. Refinements like proof-carrying code and typed assembly language [19, 18] make it possible to check and execute machine code directly rather than through interpretation. However, all widely used systems for verifying low-level code require a trusted run-time environment to provide safe memory management. Furthermore, each of these systems takes a rather ad hoc approach to initialization of heap-allocated objects. Recently, Wang and Appel [32] and Monnier, Saha, and Shao [16] have shown how to build a type-safe garbage collector based on the ideas of the Capability Calculus [29], thus eliminating most of the memory management from the trusted computing base. However, some trusted code is still required to implement the region primitives, and the region calculi on which these systems are based are relatively complicated. Furthermore, the region-based approaches do not address the initialization problem. In this paper, we step back and examine a more foundational approach to the issues of initialization and memory management for low-level code. In particular, we use a linear type system to provide a clean, elegant solution to both problems. More specifically, we present: 1. A linear type system for a conventional, MIPS-style assembly language called LTAL. 2. Theorems that show every well-typed LTAL program is sound and “leak-free” (i.e., uses bounded memory). 3. An encoding of memory management operations malloc and free within LTAL. 4. Techniques for compiling unrestricted (i.e., non-linear) high-level functional languages to LTAL in a type-preserving fashion. It is important to note that we do not consider the resulting system to be practical. The price of LTAL’s simplicity and elegance is that it does not support shared data structures. At first, such a restriction seems to preclude the use of LTAL as a target for high-level languages. However, we show that there is a type-preserving translation for a high-level ML-like language to LTAL based on explicit copying. Unfortunately, our experiments show that this naive translation is far
منابع مشابه
Sharing in Typed Module Assembly Language
There is a growing need to provide low-overhead software-based protection mechanisms to protect against malicious or untrusted code. Type-based approaches such as proof-carrying code and typed assembly language provide this protection by relying on untrusted compilers to certify the safety properties of machine language programs. Typed Module Assembly Language (TMAL) is an extension of typed as...
متن کاملTyped Assembly Language for Implementing OS Kernels in SMP/Multi-Core Environments with Interrupts
Although many people still think that it is difficult or even impossible to implement OS kernels in a strictly typed programming language, we dispelled the myth in our previous works by designing and implementing a typed assembly language which is flexible enough to implement essential functionalities of OS kernels (e.g., memory and multi-thread management facilities). Taking a step further, in...
متن کاملConstruction of a Semantic Model for a Typed Assembly Language
Typed Assembly Languages (TALs) can be used to validate the safety of assembly-language programs. However, typing rules are usually trusted as axioms. In this paper, we show how to build semantic models for typing judgments in TALs based on an induction technique, so that both the type-safety theorem and the typing rules can be proved as lemmas in a simple logic. We demonstrate this technique b...
متن کاملTALx86: A Realistic Typed Assembly Language∗
The goal of typed assembly language (TAL) is to provide a low-level, statically typed target language that is better suited than Java bytecodes for supporting a wide variety of source languages and a number of important optimizations. In previous work, we formalized idealized versions of TAL and proved important safety properties about them. In this paper, we present our progress in defining an...
متن کاملWriting practical memory management code with a strictly typed assembly language (Extended Version)
Memory management (e.g., malloc/free) cannot be implemented in traditional strictly typed programming languages because they do not allow programmers to reuse memory regions, in order to preserve memory safety. Therefore, they depend on external memory management facilities, such as garbage collection. Thus, many important programs that require explicit memory management (e.g., operating system...
متن کاملSIFTAL: A Typed Assembly Language for Secure Information Flow Analysis
We study information flow for a typed assembly language where security types restrict information flow. Inspired by recent work in continuation-based information flow analysis, our language, Secure Information Flow TAL (SIFTAL), uses low-level linear continuations in order to impose a stack discipline on the control flow of programs. The challenge posed by studying information flow analysis at ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1998